/* ==================== 基础样式 ==================== */
:root {
    /* 亮色主题 */
    --bg-color-1: #667eea;
    --bg-color-2: #764ba2;
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-secondary: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow-color: rgba(0, 0, 0, 0.2);
    --particle-color: rgba(255, 255, 255, 0.6);
    --skill-bg: rgba(255, 255, 255, 0.2);
    --skill-border: rgba(255, 255, 255, 0.4);
    
    /* 背景颜色过渡 - 1.5秒慢速动画 */
    transition: --bg-color-1 1.5s cubic-bezier(0.4, 0, 0.2, 1),
                --bg-color-2 1.5s cubic-bezier(0.4, 0, 0.2, 1),
                all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    /* 暗色主题 */
    --bg-color-1: #1a1a2e;
    --bg-color-2: #16213e;
    --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-secondary: rgba(0, 0, 0, 0.3);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.5);
    --particle-color: rgba(102, 126, 234, 0.4);
    --skill-bg: rgba(102, 126, 234, 0.15);
    --skill-border: rgba(102, 126, 234, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
    color: var(--text-primary);
    /* 使用自定义属性控制背景渐变 */
    background: linear-gradient(135deg, var(--bg-color-1) 0%, var(--bg-color-2) 100%);
    /* 关键：让背景颜色平滑过渡 */
    transition: background 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== 粒子背景 ==================== */
#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ==================== 主题切换按钮 ==================== */
.theme-toggle {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px var(--shadow-color);
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(20deg);
    box-shadow: 0 12px 40px var(--shadow-color);
}

/* ==================== 容器 ==================== */
.container {
    position: fixed; /* 改为固定定位 */
    left: 80px; /* 距离左侧边界80px */
    top: 50%;
    transform: translateY(-50%); /* 垂直居中 */
    z-index: 10;
    padding: 20px;
    width: 100%;
    max-width: 500px;
}

/* ==================== 玻璃拟态卡片 ==================== */
.profile-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 30px;
    border: 1px solid var(--glass-border);
    padding: 50px 40px;
    box-shadow: 0 8px 32px var(--shadow-color);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
}

.profile-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.profile-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 60px var(--shadow-color);
}

/* ==================== 头像区域 ==================== */
.avatar-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto 30px;
}

.avatar-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.4), transparent);
    border-radius: 50%;
    animation: pulse 3s ease-in-out infinite;
    filter: blur(20px);
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
}

.avatar-border {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
}

.avatar-circle {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: drawCircle 2s ease-out forwards;
}

@keyframes drawCircle {
    to {
        stroke-dashoffset: 0;
    }
}

.avatar {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--glass-border);
    transition: all 0.3s ease;
}

.avatar:hover {
    transform: translate(-50%, -50%) scale(1.05);
}

/* ==================== 个人信息 ==================== */
.info-section {
    text-align: center;
}

.name {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    display: inline-block;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 打字机效果 ==================== */
.typewriter-container {
    height: 40px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.typewriter-text {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.cursor {
    font-size: 1.2rem;
    color: var(--text-secondary);
    animation: blink 1s step-end infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ==================== 个人简介 ==================== */
.bio {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 25px;
    animation: fadeInUp 1s ease-out 0.2s backwards;
}

/* ==================== 技能标签 ==================== */
.skills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
    animation: fadeInUp 1.2s ease-out 0.4s backwards;
}

.skill-tag {
    padding: 8px 16px;
    background: var(--skill-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--skill-border);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
    cursor: default;
}

.skill-tag:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 5px 15px var(--shadow-color);
    background: rgba(102, 126, 234, 0.3);
}

/* ==================== 联系信息 ==================== */
.contact-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
    animation: fadeInUp 1.4s ease-out 0.6s backwards;
}

.contact-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.contact-item i {
    font-size: 1.1rem;
    color: #667eea;
}

.contact-item:hover {
    color: var(--text-primary);
    transform: translateX(5px);
}

/* ==================== 社交媒体链接 ==================== */
.social-links {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 35px;
    animation: fadeInUp 1.6s ease-out 0.8s backwards;
}

.social-btn {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 1.3rem;
    text-decoration: none;
    transition: all 0.3s ease;
    overflow: hidden;
}

.social-btn:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 10px 25px var(--shadow-color);
}

.social-btn.github:hover {
    background: #333;
    border-color: #333;
}

.social-btn.linkedin:hover {
    background: #0077b5;
    border-color: #0077b5;
}

.social-btn.twitter:hover {
    background: #1da1f2;
    border-color: #1da1f2;
}

.social-btn.weibo:hover {
    background: #e6162d;
    border-color: #e6162d;
}

.social-btn.email:hover {
    background: #ea4335;
    border-color: #ea4335;
}

/* 波纹效果 */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    pointer-events: none;
}

.social-btn:active .ripple {
    animation: rippleEffect 0.6s ease-out;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ==================== 操作按钮 ==================== */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    animation: fadeInUp 1.8s ease-out 1s backwards;
}

.btn {
    position: relative;
    padding: 14px 30px;
    border-radius: 25px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    overflow: hidden;
    z-index: 1;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn:hover {
    transform: translateY(-3px);
}

.btn-primary:hover {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.btn-secondary:hover {
    box-shadow: 0 8px 25px var(--shadow-color);
}

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn:hover .btn-glow {
    left: 100%;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1200px) {
    .container {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 600px) {
    .container {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        padding: 10px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .profile-card {
        padding: 40px 25px;
    }
    
    .name {
        font-size: 2rem;
    }
    
    .typewriter-text {
        font-size: 1rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .theme-toggle {
        top: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

/* ==================== 可访问性 ==================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .profile-card {
        border: 2px solid var(--text-primary);
    }
    
    .btn {
        border: 2px solid var(--text-primary);
    }
}

/* ==================== 主题切换波纹动效 ==================== */
.theme-ripple {
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.3), transparent);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    animation: rippleExpand 0.8s ease-out forwards;
}

@keyframes rippleExpand {
    0% {
        width: 10px;
        height: 10px;
        opacity: 1;
    }
    100% {
        width: 3000px;
        height: 3000px;
        opacity: 0;
    }
}
